/**
 * 
 */
package com.dongzhi.guestbook.dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 * @author yanzhid
 * 
 */
public class GuestbookDAO {
	@PersistenceContext
	private EntityManager entityManager;

	public List getItemsByPage(int pageNum, int pageSize) {
		Query query = entityManager.createQuery("from Guestbook");
		query.setFirstResult(pageNum * (pageSize - 1));
		query.setMaxResults(pageSize);
		return query.getResultList();
	}
}
